package demo;

public class Test {

    public static void main(String[] args) {
        Rect rect = new Rect();
        Cycle cycle = new Cycle();
        Flower flower = new Flower();

        Shape[] shapes = {cycle,cycle,rect,flower,rect};
        for (Shape shape:shapes){
            shape.draw();
        }
    }

    public static void main1(String[] args) {
        Rect rect = new Rect();
        Cycle cycle = new Cycle();
        Flower flower = new Flower();

        String[] strings = {"cycle","rect","cycle","rect","flower","cycle"};//代表从客户端拿来的请求

        for(String s: strings){
            if (s.equals("cycle")){
                cycle.draw();
            } else if (s.equals("rect")) {
                rect.draw();
            }else {
                flower.draw();
            }
        }
    }
}
